package com.hgnu.dorm.mapper;

import com.hgnu.dorm.domain.po.Permission;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface PermissionMapper {

    /*查询对应id拥有的权限*/
    List<Permission> findPermissionsByIds(List<Long> permissionIds);

    @Insert("INSERT INTO dorm.permissions(name, perms) VALUES (#{name}, #{perms})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insert(Permission permission);

    @Update("UPDATE permissions SET name=#{name}, perms=#{perms} WHERE id=#{id}")
    void update(Permission permission);

    @Delete("DELETE FROM dorm.permissions WHERE id=#{id}")
    void deleteById(@Param("id") Long id);
}
